// import com.alibaba.druid.sql.ast.SQLCommentHint;
// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "OraclePipeRowStatement.h"
#include "../../../../ast/SQLCommentHint.h"
#include "../../../../ast/SQLExpr.h"
#include "../../visitor/OracleASTVisitor.h"
#include "../../../../../utils/listTran.h"

OraclePipeRowStatement::OraclePipeRowStatement()
{
  parameters = std::make_shared<std::list<SQLExpr_ptr>>();
}

// @Override
void OraclePipeRowStatement::accept0(OracleASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(OraclePipeRowStatement)))
  {
    SQLObject_list_ptr tmp1 = ListTran::tran_class<SQLExpr, SQLObject>(parameters);
    acceptChild(visitor, tmp1);
  }
  visitor->endVisit(SharedObject(OraclePipeRowStatement));
}

SQLExpr_list_ptr OraclePipeRowStatement::getParameters()
{
  return parameters;
}

// @Override
SQLObject_ptr OraclePipeRowStatement::clone()
{
  SQLObject_ptr clone_tmp = std::shared_ptr<OraclePipeRowStatement>(new OraclePipeRowStatement());
  std::shared_ptr<OraclePipeRowStatement> x = std::dynamic_pointer_cast<OraclePipeRowStatement>(clone_tmp);
  // OraclePipeRowStatement x = new OraclePipeRowStatement();

  x->setAfterSemi(this->afterSemi);

  x->setDbType(this->dbType);

  for (SQLExpr_ptr expr : *parameters)
  {
    SQLExpr_ptr expr2 = std::dynamic_pointer_cast<SQLExpr>(expr->clone());
    expr2->setParent(x);
    x->parameters->push_back(expr2);
  }

  if (this->headHints != nullptr)
  {
    SQLCommentHint_list_ptr headHintsClone = std::make_shared<std::list<SQLCommentHint_ptr>>();
    for (SQLCommentHint_ptr hint : *headHints)
    {
      SQLCommentHint_ptr h2 = std::dynamic_pointer_cast<SQLCommentHint>(hint->clone());
      h2->setParent(x);
      headHintsClone->push_back(h2);
    }
    x->setHeadHints(headHintsClone);
  }

  return x;
}
